<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>消息-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">消息</div>
		<if condition="$al_ct neq NULL and ($status neq 1)">
		<div class="right">
			<a href="javascript:;" url="__APP__/System/message_list_all_read/status/{$status}" class="btn floatL all">全部已读</a>
		</div>
		</if>
	</div>
	<div id="content">
		<div class="filter">
			<div>
				<div class="filter-title">类型</div>
				<ul class="filter-order">
					<li>
						<a href="__APP__/Index/index_more/action/share/typ/1">分享文件</a>
					</li>
					<li>
						<a href="__APP__/Index/index_more/action/share/typ/2/rstatus/-1">被分享文件</a>
					</li>
					<li class="current">
						<a href="javascript:;">提醒 <if condition="$al_ct gt 0">({$al_ct})</if></a>
					</li>
				</ul>
			</div>
		</div>
		<div class="table-scrollx">
			<form action="__APP__/System/message_list_reads/status/{$status}/alert_type/{$alert_type}" method="POST" class="js_form">
				<table class="table table-bordered table-hover">
					<tr class="table-header fixed-table-header">
						<td>发送人</td>
						<td>内容</td>
						<td>备注</td>
						<!--
						<td>
							<select name="alert_type">
								<option value="1000"<if condition="$alert_type eq 1000"> selected</if>>类型</option>
								<option value="1"<if condition="$alert_type eq 1"> selected</if>>项目</option>
								<option value="3"<if condition="$alert_type eq 3"> selected</if>>工时</option>
								<option value="4"<if condition="$alert_type eq 4"> selected</if>>事务</option>
								<option value="2"<if condition="$alert_type eq 2"> selected</if>>交互</option>
							</select>
						</td>-->
						<td>日期</td>
						<td width="250">
							<select name="status" class="form-control">
								<option value="-10"<if condition="$status eq -10"> selected</if>>状态</option>
								<option value="-1"<if condition="$status eq -1"> selected</if>>未读</option>
								<option value="1"<if condition="$status eq 1"> selected</if>>已读</option>
							</select>
						</td>
					</tr>
					<if condition="$list eq NULL">
					<tr>
						<td colspan="5" class="text-center">暂无相关内容</td>
					</tr>
					</if>
					<foreach name="list" item="vo">
					<tr>
						<td>
							<if condition="$vo['status'] eq 1">
								{$vo['add_user']}
							<else />
								<label class="checkbox-inline"><input type="checkbox" name="id[]" value="{$vo['id']}">{$vo['add_user']}</label>
							</if>
						</td>
						<td>{$vo['content']}</td>
						<td data-id="{$vo['id']}">
							{$vo['remark']}
							<if condition="$vo['url'] neq NULL">
								<a href="javascript:;" url="{$vo['url']}" id="{$vo['id']}" class="tiaoz">点此跳转</a>
							</if>
						</td>
						<!--
						<td>
							<if condition="$vo['type'] eq 1">项目
							<elseif condition="$vo['type'] eq 3"/>工时
							<elseif condition="$vo['type'] eq 4"/>事务
							<elseif condition="$vo['type'] eq 2"/>交互</if>
						</td>-->
						<td>{$vo['add_date']|substr=0,10} </td>
						<td>
							<if condition="$vo['status'] eq 1">已读<else />未读</if>
							<if condition="$vo['status'] eq -1">
							<a href="#" rel="tooltip" data-placement="left" data-original-title="标记为已读" onclick="update2('{$vo['id']}','{$vo['url']}');return false;"><i class="glyphicon glyphicon-comment"></i></a>
							</if>
						</td>
					</tr>
					</foreach>
					<if condition="($al_ct neq NULL) and ($status neq 1)">
					<tr>
						<td colspan="6"> 
							<label class="checkbox-inline"><input type="checkbox" class="selall">全选</label>
							<input type="button" class="btn ml10 readedform-control" value="批量已读"> 
						</td>
					</tr>
					</if>
				</table>
			</form>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<div class="modal fade" id="myModal_submit">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>重新提交</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm1">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<!--对话框-->
<div id="myModal_read" class="modal fade">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>确认提示框</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">您确定要批量已读吗?</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm ok_startup">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
			</div>
		</div>
	</div>
</div>
<div id="myModal_all" class="modal hide fade">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>确认提示框</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">您确定要将全部提醒已读吗?</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm ok_startall">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
	$(function() {
		$(".tiaoz").click(function(){
			var id = $(this).parents("td").attr("data-id");
			var url = $(this).attr("url");
			
			$.ajax({
				type:"post",
				data:{"id":id},
				url:"__APP__/System/message_list_tz_read",
				success:function(data){
					document.location.href = url;
				}
			})
		})
		
		 $(".all").click(function(){
			 var uid = $(this).attr("url");
			$("#myModal_all").find(".ok_startall").attr("url",uid);
			$('#myModal_all').modal('toggle');
		});
		
		$(".ok_startall").click(function(){
			var url = $(this).attr("url");
			window.location.href = url;
		});

		
		$(".readedform-control").click(function(){
			$('#myModal_read').modal('toggle');
		});

		$("#myModal_read .ok_startup").click(function(){
			$(".js_form").submit();
		});

		$(".selall").click(function(){
			if( $(this).is(":checked") ){
				$(":checkbox:not('.selall')").attr("checked",true);
			}else{
				$(":checkbox:not('.selall')").attr("checked",false);
			}
		});
		
		$("[name=status]").change(function(){
			var val = $(this).val();
			window.location.href = "__APP__/System/message_list/status/"+val+"/alert_type/{$alert_type}";
		});
		
		$("[name=alert_type]").change(function(){
			var val = $(this).val();
			window.location.href = "__APP__/System/message_list/status/{$status}/alert_type/"+val;
		});

		$('a[rel=tooltip]').tooltip({});
	});
	
	function update2(id,url)
	{
		var id;
		var url;
		$.post
		(
			"__APP__/System/message_list_read", 
			{id:id}, 
			function(datas){ 
				window.location.reload();
			}
		); 
	}
</script>
</body>
</html>